﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using CRM.UTIL;

namespace CRM.DAL.Ali
{

    public class Ali_MaintenanceD : DBChannel
    {
        /// <summary>
        /// 可以在此选择数据库连接，默认为CRM
        /// </summary>
        public Ali_MaintenanceD() : base()
        {
        }


        #region 执行存储过程 Pro_GetAli_Maintenance ,根据条件获取回馈信息

        /// <summary>
        /// 执行存储过程 Pro_GetAli_Maintenance 
        ///xialei
        /// </summary>

        public DataTable ExecuteGetAli_Maintenance(ref CRM.MODEL.Ali.GetAli_Maintenance stu)
        {
            //存储过程参数	 		     
            this.sqlCmd.Parameters.Add(new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.IDPARM,
                SqlDbType.Int));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.SUPPLIERIDPARM, SqlDbType.Int));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.ORDERIDPARM, SqlDbType.Int));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.MAINTPOINTGETPRODUCTTIMEPARM,
                    SqlDbType.DateTime));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.MAINTENANCESTARTTIMEPARM,
                    SqlDbType.DateTime));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.MAINTENANCEENDTIMEPARM,
                    SqlDbType.DateTime));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.MAINTPOINTSENDPRODUCTTIMEPARM,
                    SqlDbType.DateTime));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.USERGETPRODUCTTIMEPARM,
                    SqlDbType.DateTime));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.USEREXPRESSTYPEPARM,
                    SqlDbType.VarChar));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.USEREXPRESSAMOUNTPARM,
                    SqlDbType.VarChar));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.MAINTENANCENOPARM,
                    SqlDbType.VarChar));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.MAINTENANCESTATUSPARM,
                    SqlDbType.Int));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.REMARKPARM, SqlDbType.VarChar));

            //分页参数
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.ORDERSTRING_PARM,
                    SqlDbType.VarChar, 1000));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.PAGESIZE_PARM, SqlDbType.Int));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.CURRENTPAGEINDEX_PARM,
                    SqlDbType.Int));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.GetAli_Maintenance.TOTALITEMS_PARM,
                    SqlDbType.Decimal));

            //设置参数的值
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.IDPARM].Value = stu.IDVALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.SUPPLIERIDPARM].Value =
                stu.SUPPLIERIDVALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.ORDERIDPARM].Value =
                stu.ORDERIDVALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.MAINTPOINTGETPRODUCTTIMEPARM]
                .Value = stu.MAINTPOINTGETPRODUCTTIMEVALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.MAINTENANCESTARTTIMEPARM]
                .Value = stu.MAINTENANCESTARTTIMEVALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.MAINTENANCEENDTIMEPARM].Value
                = stu.MAINTENANCEENDTIMEVALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.MAINTPOINTSENDPRODUCTTIMEPARM
                ].Value = stu.MAINTPOINTSENDPRODUCTTIMEVALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.USERGETPRODUCTTIMEPARM].Value
                = stu.USERGETPRODUCTTIMEVALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.USEREXPRESSTYPEPARM].Value =
                stu.USEREXPRESSTYPEVALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.USEREXPRESSAMOUNTPARM].Value
                = stu.USEREXPRESSAMOUNTVALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.MAINTENANCENOPARM].Value =
                stu.MAINTENANCENOVALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.MAINTENANCESTATUSPARM].Value
                = stu.MAINTENANCESTATUSVALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.REMARKPARM].Value =
                stu.REMARKVALUE;

            //设置分页参数的值
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.ORDERSTRING_PARM].Value =
                stu.ORDERSTRING_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.PAGESIZE_PARM].Value =
                stu.PAGESIZE_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.CURRENTPAGEINDEX_PARM].Value
                = stu.CURRENTPAGEINDEX_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.TOTALITEMS_PARM].Value =
                stu.TOTALITEMS_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.TOTALITEMS_PARM].Direction =
                ParameterDirection.Output;

            //执行
            DataTable dt = this.GetDataByProcedure("dbo.Pro_GetAli_Maintenance");
            //获取数据库的信息
            stu.TOTALITEMS_VALUE =
                this.sqlCmd.Parameters[CRM.MODEL.Ali.GetAli_Maintenance.TOTALITEMS_PARM].Value;

            return dt;
        }

        #endregion

        #region 执行存储过程 Pro_EditAli_Maintenance,根据条件获取回馈信息

        /// <summary>
        /// 执行存储过程 Pro_EditAli_Maintenance 的相关参数
        ///xialei
        /// </summary>
        public int ExecuteEditAli_Maintenance(ref CRM.MODEL.Ali.EditAli_Maintenance stu)
        {
            //动作参数
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.ACTION_PARM, SqlDbType.VarChar,
                    20));
            //错误信息参数
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.ERRMSG_PARM, SqlDbType.VarChar,
                    100));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.OUTID_PARM, SqlDbType.Int));
            ////表字段参数
            this.sqlCmd.Parameters.Add(new SqlParameter(
                CRM.MODEL.Ali.EditAli_Maintenance.IDPARM, SqlDbType.Int));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.SUPPLIERIDPARM, SqlDbType.Int));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.ORDERIDPARM, SqlDbType.Int));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.MAINTPOINTGETPRODUCTTIMEPARM,
                    SqlDbType.DateTime));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.MAINTENANCESTARTTIMEPARM,
                    SqlDbType.DateTime));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.MAINTENANCEENDTIMEPARM,
                    SqlDbType.DateTime));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(
                    CRM.MODEL.Ali.EditAli_Maintenance.MAINTPOINTSENDPRODUCTTIMEPARM,
                    SqlDbType.DateTime));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.USERGETPRODUCTTIMEPARM,
                    SqlDbType.DateTime));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.USEREXPRESSTYPEPARM,
                    SqlDbType.VarChar));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.USEREXPRESSAMOUNTPARM,
                    SqlDbType.VarChar));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.MAINTENANCENOPARM,
                    SqlDbType.VarChar));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.MAINTENANCESTATUSPARM,
                    SqlDbType.Int));
            this.sqlCmd.Parameters.Add(
                new SqlParameter(CRM.MODEL.Ali.EditAli_Maintenance.REMARKPARM, SqlDbType.VarChar));



            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.ACTION_PARM].Value =
                stu.ACTION_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.ERRMSG_PARM].Direction =
                ParameterDirection.Output;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.OUTID_PARM].Direction =
                ParameterDirection.Output;
            //设置参数的值
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.IDPARM].Value = stu.ID_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.SUPPLIERIDPARM].Value =
                stu.SUPPLIERID_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.ORDERIDPARM].Value =
                stu.ORDERID_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.MAINTPOINTGETPRODUCTTIMEPARM
                ].Value = stu.MAINTPOINTGETPRODUCTTIME_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.MAINTENANCESTARTTIMEPARM]
                .Value = stu.MAINTENANCESTARTTIME_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.MAINTENANCEENDTIMEPARM]
                .Value = stu.MAINTENANCEENDTIME_VALUE;
            this.sqlCmd.Parameters[
                CRM.MODEL.Ali.EditAli_Maintenance.MAINTPOINTSENDPRODUCTTIMEPARM].Value =
                stu.MAINTPOINTSENDPRODUCTTIME_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.USERGETPRODUCTTIMEPARM]
                .Value = stu.USERGETPRODUCTTIME_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.USEREXPRESSTYPEPARM].Value =
                stu.USEREXPRESSTYPE_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.USEREXPRESSAMOUNTPARM].Value
                = stu.USEREXPRESSAMOUNT_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.MAINTENANCENOPARM].Value =
                stu.MAINTENANCENO_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.MAINTENANCESTATUSPARM].Value
                = stu.MAINTENANCESTATUS_VALUE;
            this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.REMARKPARM].Value =
                stu.REMARK_VALUE;

            int i = this.ExecuteProcedure("dbo.Pro_EditAli_Maintenance"); //执行	
            //获取数据库的信息
            stu.ERRMSG_VALUE =
                this.sqlCmd.Parameters[CRM.MODEL.Ali.EditAli_Maintenance.ERRMSG_PARM].Value;
            return i;
        }

        #endregion
    }

}
